import { Behaviour, Transform } from "./gameengine";

export class anim_alpha extends Behaviour {
    private i: number = 100;

    protected onStart() {

    }

    protected onUpdate(advancedTime: number) {
        this.i--;
        if (this.i >= 0) {
            this.displayObject.alpha = this.i / 100;
        }
        else{
            this.displayObject.parent.removeChild(this.displayObject);
        }

    }

}



export class anim_scale extends Behaviour {
    private i: number = 0.6;

    protected onStart() {

    }

    protected onUpdate(advancedTime: number) {
        if (this.i <= 20) {
            this.i++;
            const transform = this.displayObject.getScript(Transform);

            transform.scaleX = transform.scaleY = this.i / 30;
        }
    }

}